package edu.wpi.first.wpilibj.templates.commandGroups;

import edu.wpi.first.wpilibj.command.CommandGroup;
import edu.wpi.first.wpilibj.templates.commands.DriveStraight;
import edu.wpi.first.wpilibj.templates.commands.Turn;

/**
 * This class defines a group of commands that execute to command the drive
 * train (chassis) to drive the robot in a square.
 * @author anne
 */
public class DriveInASquare extends CommandGroup {
    
    public DriveInASquare() {
        // Add Commands here:
        // e.g. addSequential(new Command1());
        //      addSequential(new Command2());
        // these will run in order.

        // To run multiple commands at the same time,
        // use addParallel()
        // e.g. addParallel(new Command1());
        //      addSequential(new Command2());
        // Command1 and Command2 will run in parallel.

        // A command group will require all of the subsystems that each member
        // would require.
        // e.g. if Command1 requires chassis, and Command2 requires arm,
        // a CommandGroup containing them would require both the chassis and the
        // arm.
        
        /**
         * Set up to execute commands to drive the robot in a square. A square
         * can be accomplished by driving the robot straight for 1 second, then
         * turning 90 degrees and driving straight again, etc. until the square
         * is reached. At that time the command group will complete.
         * Note: Because each command is being added sequentially, each command
         * will complete before the next one executes. 
         */
        addSequential(new DriveStraight(1)); // Drive straight 1 second
        addSequential(new Turn(1));
        addSequential(new DriveStraight(1));
        addSequential(new Turn(1));
        addSequential(new DriveStraight(1));
        addSequential(new Turn(1));
        addSequential(new DriveStraight(1));
    }
}
